package com.gxwuz.maven.dao;

import java.util.List;

import com.gxwuz.maven.entity.Business;

public class BusinessDao extends BaseDao{
	public List<Business> getAll(){
		String hql = "from Business";
		return getSession().createQuery(hql).list();
	}
	
	public void delete(Integer id) {
		String  hql = "delete Business where ID = ?";
		getSession().createQuery(hql).setInteger(0, id).executeUpdate();
	}
	
	public void save(Business business) {
		getSession().saveOrUpdate(business);
	}
	
	public void update(Integer id, String name, String price) {
		String hql = "update Business  set NAME=name, PRICE=price where ID=id";
		getSession().createQuery(hql).executeUpdate();
	}
}
